package com.candy.candymessage.spi;

import java.util.Iterator;
import java.util.ServiceLoader;

/**
 * @author suYanLong
 * @version 1.0
 * @date 2023/3/17 13:27
 * @Description 描述
 */
public class Test {

    public static void main(String[] args) {
        ServiceLoader<Animal> load = ServiceLoader.load(Animal.class);
        Iterator<Animal> iterator = load.iterator();
        while (iterator.hasNext()) {
            Animal next = iterator.next();
            next.eat();
        }
    }

}
